<template>
  <div>
    <div class="box">
      <div class="header">
        <div class="td-h-left"><img src="images/today.png" alt=""></div>
        <div class="td-h-right">
          <router-link to="/tdSaleDec">查看更多</router-link>
        </div>
      </div>
    </div>
    <ul>
      <li v-for="v in arr" :key="v.id" @click="goDetail(v.categoryId)">
        <img :src="v.posterUrl" alt="">
        <span>
          <i class="iconfont icon-huo">演出即将开始</i>
        </span>
        <div class="title">{{v.name}}</div>
      </li>
    </ul>
  </div>
</template>
<script>
import getLink from '@/api/getLink.js'
export default {
  data() {
    return {
      arr: []
    }
  },
  created() {
    getLink('/show/today').then(res => {
      this.arr = res.data
    })
  },
  methods: {
    goDetail(todaynum) {
      this.$router.push({
        path: '/detail',
        query: {
          todaysale: todaynum
        }
      })
    }
  }
}
</script>
<style scoped>
.box {
  margin: auto;
  width: 90%;
  display: flex;
  margin-top: 0.2rem;
}
.header {
  width: 100%;
  height: 0.6rem;
  /* background-color: darkcyan; */
  display: flex;
  justify-content: space-between;
}
.td-h-left img {
  width: 1.8rem;
}
.td-h-right a {
  display: block;
  width: 1.5rem;
  height: 0.46rem;
  line-height: 0.5rem;
  text-align: center;
  color: #000;
  background-color: #eeebeb;
  border-radius: 0.5rem;
}
ul {
  display: flex;
  justify-content: space-around;
  width: 90%;
  margin: auto;
}
li {
  float: left;
  width: 50%;
  height: 4.4rem;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  overflow: hidden;
}
li img {
  width: 98%;
  height: 2.8rem;
  border-radius: 0.2rem;
  margin-bottom: 0.2rem;
}
li .title {
  width: 98%;
  margin: auto;
  height: 0.8rem;
  line-height: 0.8rem;
  text-align: center;
  font-weight: bold;
  /* background-color: aqua; */
  overflow: hidden;
}
li span {
  display: block;
  width: 1.7rem;
  height: 0.4rem;
  background-image: linear-gradient(to right, #ffcc20, #ff3f36);
  color: #ffffff;
  border-radius: 0.1rem;
  margin: auto;
  text-align: center;
}
li span i {
  font-size: 0.22rem;
  line-height: 0.4rem;
}
</style>